package com.talent.jiwen_teacher.my;

import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.talent.jiwen_teacher.R;
import com.talent.jiwen_teacher.base.BaseActivity;
import com.talent.jiwen_teacher.util.ImageUtil;
import com.talent.jiwen_teacher.util.SPConstant;
import com.talent.jiwen_teacher.util.SPUtil;

import butterknife.BindView;
import butterknife.OnClick;

import static com.talent.jiwen_teacher.util.Constant.partList;
import static com.talent.jiwen_teacher.util.Constant.subList;


/**
 * Created by qyqx on 2018/8/17.
 * 个人信息
 */

public class PersonInfoActivity extends BaseActivity {

    @BindView(R.id.rl_up_head)
    RelativeLayout rl_up_head;
    @BindView(R.id.img_head)
    ImageView img_head;
    @BindView(R.id.txt_name)
    TextView txt_name;
    @BindView(R.id.txt_subject)
    TextView txt_subject;
    @BindView(R.id.txt_range)
    TextView txt_range;
    @BindView(R.id.edit_teach_years)
    TextView edit_teach_years;
    @BindView(R.id.txt_school)
    TextView txt_school;
    @BindView(R.id.txt_type)
    TextView txt_type;

    @BindView(R.id.ll_teach_year)
    RelativeLayout ll_teach_year;



    @Override
    protected int provideContentViewId() {
        return R.layout.activiy_person_info;
    }

    @Override
    public String titleName() {
        return "个人信息";
    }

    @Override
    protected void initData() {

        ImageUtil.loadCircleImage(PersonInfoActivity.this, SPUtil.getUserHeadUrl(),img_head);
        txt_name.setText(SPUtil.getUserName());
        if(SPUtil.intOut(SPConstant.SUBJECT_ID)!=0 && SPUtil.intOut(SPConstant.TEACH_PART)!=0){
            txt_subject.setText(subList[SPUtil.intOut(SPConstant.SUBJECT_ID)-1]);
            txt_range.setText(partList[SPUtil.intOut(SPConstant.TEACH_PART)-1]);
        }
        txt_school.setText(SPUtil.stringOut(SPConstant.GRADUATE_SCHOOL_NAME));

//        SPUtil.stringIn(SPConstant.GRADUATE_SCHOOL_NAME,teacherInfo.getGraduatedSchool());

        if(SPUtil.intOut(SPConstant.TEACHER_IDENTITY)==1){///教师身份 1 在校教师 2 名校学霸
            txt_type.setText("在职名师");
            ll_teach_year.setVisibility(View.VISIBLE);
            edit_teach_years.setText(SPUtil.stringOut(SPConstant.TEACH_YEARS)+"年");
        }else{
            ll_teach_year.setVisibility(View.GONE);
            txt_type.setText("名校学霸");
        }
    }

    @OnClick({R.id.rl_up_head})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_up_head:

                break;

        }
    }
}
